package com.chepaandvasia.dao;

import java.util.List;

import com.chepaandvasia.entities.Role;
import com.chepaandvasia.entities.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public interface UserDAO {

    /*
     * This method inserts User user in the database.
     * While inserting, user is given unique id
     * @param user instance of User  to be created     
     */
    public void create(User user);

    /*
     * This method updates state of User into database
     * @param user instance of User to be updated in database     * 
     */
    public void update(User user);

    /*
     * This method removes User user from database.
     * @param user instance of User to be removed
     */
    public void remove(User user);

    /*
     * This method get instance of User, specified with given id, from database.
     * @param id id of User to be retrieved
     * @return instance of User with given id     
     */
    public User get(Long id);
    /*
     * This method finds all available users for given role.
     * @param role instance of Role
     * @return list of Users of given role
     */

    public List<User> findAllUsersForRole(Role position);

    /*
     * This method find all users including
     * @return list of all Users 
     */
    public List<User> findAllUsers();

    public UserDetails getUserWithLogin(String login) throws UsernameNotFoundException;
}
